package com.action;

import java.util.HashSet;
import java.util.Set;

import org.apache.struts2.convention.annotation.Action;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionContext;
import com.pojo.Company;
import com.pojo.Contact;
import com.pojo.User;
import com.service.ContactService;

public class ContactsAction {

	@Autowired
	private ContactService contactService;
	private User user=(User) ActionContext.getContext().getSession().get("user");
	private Set<Contact> contacts;
	private Set<Company> companies;

	public void setContactService(ContactService contactService) {
		this.contactService = contactService;
	}
	
	@Action("contacts")
	public String execute(){
		contacts=user.getContacts();
		companies=user.getCompanies();
		return "success";
	}

	public Set<Contact> getContacts() {
		return contacts;
	}

	public void setContacts(Set<Contact> contacts) {
		this.contacts = contacts;
	}

	public Set<Company> getCompanies() {
		return companies;
	}

	public void setCompanies(Set<Company> companies) {
		this.companies = companies;
	}
	
	
	
}
